require('../lib/es6-promise.min.js')
const STUDENT = {}
import httphelper from '../common/httphelper';
import APIURL from '../const/APIURL'
STUDENT.RegStudent=function (data)
{
  var p = new Promise(function func(resolve, reject) {
    httphelper.post(APIURL.REGSTUDENT,data).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}
STUDENT.GetStudent = function (tzsh) {
  var p = new Promise(function func(resolve, reject) {
    httphelper.get(APIURL.GETSTUDENTDETAIL,tzsh).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}
STUDENT.GetStudentsBytzsh = function (data) {
  var p = new Promise(function func(resolve, reject) {
    httphelper.get(APIURL.GETSTUDENTSBYTZSH ,data).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}
STUDENT.GetLatestStudents = function (data) {
  var p = new Promise(function func(resolve, reject) {
    httphelper.get(APIURL.GETLATESTSTUDENTS,data).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}
STUDENT.SearchStudents = function (data) {
  var p = new Promise(function func(resolve, reject) {
    httphelper.get(APIURL.SEARCHSTUDENTS, data).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}
export default STUDENT;